package com.happy016.entity.user;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * 框架 Demo
 * @author linyb
 * create on 2017/8/4 10:13
 */
public class User  {
    private Integer id;
    //效验 username长度为2-10,error返回 message 信息
    @Length(min = 2,max = 10,message = "username长度2-10")
    private String username;
    //效验手机号正则
    @NotBlank
    @Pattern(regexp="^1[34578]\\d{9}$" ,message = "手机号格式不对")
    private String telephone;

    //时间类型 如果前端传过来 2017-06-06 valid无法自动转换
    private Date   createTime;
    private Integer status;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
}
